﻿using GameEditor.View;
using GameEditor.View.Components;
using PureMVC.Interfaces;
using PureMVC.Patterns;
using GameEngine.View.Components;
using System;
using GameEngine.Model;

namespace GameEditor.Commands
{
    /// <summary>
    /// 
    /// </summary>
    public class CreateResourceEditor_Command<MyIdType> : SimpleCommand
        where MyIdType : IComparable<MyIdType>
    {
        override public void Execute(INotification notification)
        {
            if (notification.Body == null)
                throw new Exception(this.GetType().Name + " has to have body");

            var dataProxy = notification.Body as IResourceDataProxy;

            var editorMediator = GameEditorViewFacade<MyIdType>.Instance.CreateResourceEditorMenuMediator(
                GameEditorFacade.ResourceEditorMediatorName,
                GameEditorViewFacade<MyIdType>.Instance.CreateResourceEditorMenuView(),
                dataProxy
                );

            //TODO editorMediator.

            Facade.RegisterMediator(editorMediator);
        }
    }
}
